package com.swf.seed.util;

import java.util.Calendar;

public class SdDateUtils {
	public static void main(String[] args) {
		Calendar calendar = Calendar.getInstance();
		for (int i=0;i<500;i++){
		int year = calendar.get(Calendar.YEAR);
		int month = calendar.get(Calendar.MONTH)+1;
		int day = calendar.get(Calendar.DATE);
		String sql = "insert into hstest.topenday (D_DATE, L_WORKFLAG, C_MEMO, VC_TACODE)"+
"values (to_date('%s-%s-%s', 'dd-mm-yyyy'), %s, null, '25');";
		int workday = 1;
		if(calendar.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY||calendar.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY){
			workday = 0;
		}
		System.out.println(String.format(sql, add(day),add(month),year,workday));
		calendar.set(Calendar.DATE, day+1);
		}
	}
	
	public static String add(int i){
		String s = String.valueOf(100+i);
		return s.substring(1);
	}
}
